export default function detailCanvas(that,sWidth,sHeight,headimgUrl,imgUrl,codeImg,title,market_price,nickName,callback){
  let rpx = sWidth;
  const cxt = wx.createCanvasContext('myCanvas',that);
  cxt.save();

  cxt.fillStyle = "#ffffff", 
  cxt.fillRect(0, 0,315,370), 
  cxt.fillStyle = "#F83E3A", 
  cxt.fillRect(0, 0,315, 190),
  cxt.save();

  

     cxt.save();
     cxt.beginPath(),
     cxt.arc(32, 32,17, 0, 2 * Math.PI), 
     cxt.closePath(),
     cxt.clip(),
     cxt.drawImage(headimgUrl,16,16,34,34), 
     cxt.restore();



  cxt.font = "10px Arial",
  cxt.fillStyle = "#ffffff", 
  cxt.fillText("".concat(nickName || "未设置昵称", "发现一件好物，帮TA砍价到底吧"),59,35), 
  cxt.save();

  cxt.beginPath(), 
  cxt.moveTo(15,64),
  cxt.lineTo(300,64), 
  cxt.lineTo(300,175), 
  cxt.lineTo(15, 175), 
  cxt.closePath(), 
  cxt.fillStyle = "#ffffff",
  cxt.fill(),
  cxt.save();
  


  cxt.beginPath(), 
  cxt.moveTo(25, 74), 
  cxt.lineTo(115,74), 
  cxt.lineTo(115, 164), 
  cxt.lineTo(25, 164), 
  cxt.closePath(), 
  cxt.clip(),
  cxt.drawImage(imgUrl, 25,74,90,90), 
  cxt.restore();

  cxt.font = "11px Arial",
  cxt.fillStyle = "#444444",
  cxt.fillText(title,125,90 + 0 * 13);
  
  cxt.font = "10px Arial", 
  cxt.fillStyle = "#F83E3A",
  cxt.fillText("最低价￥".concat(market_price),125,155);

  cxt.font = "10px Arial", 
  cxt.fillStyle = "#666666",
  cxt.fillText("我正在看这个，觉得不错！",15,272);
  cxt.font = "10px Arial",
  cxt.fillStyle = "#666666",
  cxt.fillText("长按识别小程序，一起来看吧~", 15,292), 
  cxt.save();

  cxt.beginPath(), 
  cxt.moveTo(175,215),
  cxt.lineTo(300,215), 
  cxt.lineTo(300,340),
  cxt.lineTo(175, 340), 
  cxt.closePath(), 
  cxt.clip(),
  cxt.drawImage(codeImg,175,215,125, 125), 
  cxt.restore()


  cxt.draw(false,()=>{
      wx.canvasToTempFilePath({
          x: 0,
          y: 0,
          canvasId:"myCanvas",
          fileType: 'png',
          success: (res)=>{
              callback(res.tempFilePath)
          },
         
      }, that);
  });
}